path_dict = {
            65: {
                '111': {'22': {'333': {'444': 4042}}, '555': {'666': {'777': 4043}}}},
            75: {'888': {'999': {'101010': None, '飙升': None}, 'aaa': {'bbb': None, 'nnn': None}}},
            110: {'ccc': {'ddd': 4209}, 'fff': {'eee': 4908}}
        }

def get_parameters(doc):
    for task_id, brand_dict in path_dict.items():
        for brand, dict1 in brand_dict.items():
            if type(dict1) == int:
                if dict == doc:
                    return task_id, brand
            else:
                g = gg(dict1, doc)
                if g == 'pass':
                    pass
                elif g:
                    return task_id, brand, g


def gg(dict_g, doc):
    for key, value in dict_g.items():
        if type(value) == int:
            if value == doc:
                return key
            else:
                return 'pass'
        elif not value:
            return 'pass'
        else:
            g = gg(value, doc)
            # print(g)
            # print(type(g))
        if g == 'pass':
            pass
        elif g:
            return key

if __name__ == '__main__':
    g = get_parameters(4908)
    print(g)
